﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Windows.Forms;

namespace PurchaseManager
{
    public class Utils
    {
        /// <summary>
        /// Debug View 등에 로그 남기기
        /// </summary>
        /// <param name="msg"> 남기고자 하는 msg </param>
        static public void Log(string msg)
        {
            Trace.WriteLine("PurchaseManager :" + msg);
        }

        // Message Box  띄우는 것도 추가 해야 함

        // Folder Dialog
        static public string OpenFolderDialog()
        {
            FolderBrowserDialog dialog = new FolderBrowserDialog();

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                return dialog.SelectedPath;
            }

            return string.Empty;
        }

        static public string SaveFileDialaog(string filter)
        {
            SaveFileDialog dialog = new SaveFileDialog();

            dialog.Filter = filter;

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                return dialog.FileName;
            }

            return string.Empty;
        }

        static public string OpenFileDialog(string filter)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Multiselect = false;
            dialog.Filter = filter;

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                return dialog.FileName;
            }

            return string.Empty;
        }
    }
}
